import { defineHttp } from '@/plugins/http'
import { API_BASE_URL, API_TIMEOUT } from '@/config'

export const useHttp = <R = any, D = any>() =>
  defineHttp<R, D>('index', {
    baseURL: API_BASE_URL,
    timeout: API_TIMEOUT,
    dataField: 'data',
    requestInterceptor: (config) => {
      return config
    },
    responseInterceptor: (response) => response
  })
